package com.kzw.oa.exam.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderColumn;
import javax.persistence.Table;

import com.kzw.oa.system.model.AppUser;

/**
 * 考试结果：考试开始后初始化，分配题目（一份试卷的答卷）
 */
@Entity
@Table(name = "exam_result")
public class ExamResult {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long oid;

	// 学生
	@ManyToOne
	@JoinColumn
	private AppUser student;

	// 考试
	@ManyToOne
	@JoinColumn
	private Examine examine;

	// 考试状态（0未提交、1已提交、2已批改）
	private int status;

	// 提交时间
	private Date ctime;

	// 答案
	@OneToMany(mappedBy = "result")
	@OrderColumn(name = "idx")
	private List<Answer> answers = new ArrayList<>();

	// 评卷教师
	@ManyToOne
	@JoinColumn
	private AppUser teacher;

	// 成绩
	private Integer score;

	public Long getOid() {
		return oid;
	}

	public void setOid(Long oid) {
		this.oid = oid;
	}

	public AppUser getStudent() {
		return student;
	}

	public void setStudent(AppUser student) {
		this.student = student;
	}

	public Examine getExamine() {
		return examine;
	}

	public void setExamine(Examine examine) {
		this.examine = examine;
	}

	public List<Answer> getAnswers() {
		return answers;
	}

	public void setAnswers(List<Answer> answers) {
		this.answers = answers;
	}

	public AppUser getTeacher() {
		return teacher;
	}

	public void setTeacher(AppUser teacher) {
		this.teacher = teacher;
	}

	public Integer getScore() {
		return score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Date getCtime() {
		return ctime;
	}

	public void setCtime(Date ctime) {
		this.ctime = ctime;
	}

}
